/**
 * 
 */
package com.geezdata.cps.base.response;

import java.util.List;

import com.alibaba.fastjson.annotation.JSONField;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;

/**
 * @author sszheng
 * @date 创建时间：2017年11月9日 下午6:42:51
 *
 */
public class PagableResult<T> {
	@JSONField(name="page_size")
    private Integer pageSize;
	
	@JSONField(name="page_no")
    private Integer pageNo;
	
	@JSONField(name="total")
    private Long total;
	
	private List<T> list;

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public Integer getPageNo() {
		return pageNo;
	}

	public void setPageNo(Integer pageNo) {
		this.pageNo = pageNo;
	}

	public Long getTotal() {
		return total;
	}

	public void setTotal(Long total) {
		this.total = total;
	}
	
	public List<T> getList() {
		return list;
	}

	public void setList(List<T> list) {
		if(list instanceof Page) {
			PageInfo<T> pi = new PageInfo<>(list);
			this.pageNo = pi.getPageNum();
			this.pageSize = pi.getPageSize();
			this.total = pi.getTotal();
		}
		this.list = list;
	}
}
